#include"process.h"
#include<string.h>
#include<unistd.h>

#define NUM 101
#define STYLE '='

void FlushProcess(double total, double current)
{
   char arr[NUM];
   memset(arr,0,sizeof(arr));
   const char * lable ="|/-\\";
   static int cnt=0;
   int len =strlen(lable);
   int num=(int)(current*100/total);
   for(int i=0;i<num;i++)
     arr[i]=STYLE;
   cnt%=len;
   double rate =current/total;
   printf("[%-100s][%.1f%%][%c]\r",arr,rate*100,lable[cnt]);
   cnt++;
   fflush(stdout);

}

